
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>构建定制包 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="dynamic_failed_help.html" />
    
    
    <link rel="prev" href="help.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    原理解析
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../principle-intro/Runtime_principle.html">
            
                <a href="../principle-intro/Runtime_principle.html">
            
                    
                    框架原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../principle-intro/Project_architectured.html">
            
                <a href="../principle-intro/Project_architectured.html">
            
                    
                    名词解释
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../principle-intro/Apk_architecture.html">
            
                <a href="../principle-intro/Apk_architecture.html">
            
                    
                    APK结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../principle-intro/File_architecture_runtime.html">
            
                <a href="../principle-intro/File_architecture_runtime.html">
            
                    
                    运行期文件结构
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../guide-for-use/">
            
                <a href="../guide-for-use/">
            
                    
                    接入指引
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../guide-for-use/guide_for_build.html">
            
                <a href="../guide-for-use/guide_for_build.html">
            
                    
                    容器接入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../guide-for-use/guide_for_bundle.html">
            
                <a href="../guide-for-use/guide_for_bundle.html">
            
                    
                    bundle拆分|新建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../guide-for-use/guide_for_compile.html">
            
                <a href="../guide-for-use/guide_for_compile.html">
            
                    
                    awo编译
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../guide-for-use/bundleCommunicate.html">
            
                <a href="../guide-for-use/bundleCommunicate.html">
            
                    
                    跨bundle的代码重用和通信
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../update/">
            
                <a href="../update/">
            
                    
                    动态部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../update/principle.html">
            
                <a href="../update/principle.html">
            
                    
                    技术原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../update/dexpatch.html">
            
                <a href="../update/dexpatch.html">
            
                    
                    dexpatch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../update/dexpatch_use_guide.html">
            
                <a href="../update/dexpatch_use_guide.html">
            
                    
                    dexpatch使用教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../update/guide.html">
            
                <a href="../update/guide.html">
            
                    
                    一些限制
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    FAQ
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="question.html">
            
                <a href="question.html">
            
                    
                    问答
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="help.html">
            
                <a href="help.html">
            
                    
                    故障排查
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.3" data-path="variant.html">
            
                <a href="variant.html">
            
                    
                    构建定制包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="dynamic_failed_help.html">
            
                <a href="dynamic_failed_help.html">
            
                    
                    动态部署失败排查指南
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    源码分析
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../code_read/atlas_gradle_apk/atlas_atlas_gradle_apk.html">
            
                <a href="../code_read/atlas_gradle_apk/atlas_atlas_gradle_apk.html">
            
                    
                    Atlas之Gradle配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../code_read/atlas_start/atlas_start_1.html">
            
                <a href="../code_read/atlas_start/atlas_start_1.html">
            
                    
                    Atlas之启动过程(一)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../code_read/atlas_start/atlas_start_2.html">
            
                <a href="../code_read/atlas_start/atlas_start_2.html">
            
                    
                    Atlas之启动过程(二)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../code_read/atlas_bundle_load/atlas_bundle_load.html">
            
                <a href="../code_read/atlas_bundle_load/atlas_bundle_load.html">
            
                    
                    Atlas之Bundle加载过程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >构建定制包</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x5982;&#x4F55;&#x6784;&#x5EFA;&#x4E0D;&#x540C;&#x7684;&#x5305;">&#x5982;&#x4F55;&#x6784;&#x5EFA;&#x4E0D;&#x540C;&#x7684;&#x5305;</h2>
<p>google&#x63D2;&#x4EF6;&#x5BF9;&#x5E94;&#x7684;&#x6587;&#x6863;&#x5730;&#x5740;&#xFF1A; <a href="https://developer.android.com/studio/build/build-variants.html?hl=zh-cn" target="_blank">https://developer.android.com/studio/build/build-variants.html?hl=zh-cn</a> &#xFF0C; &#x539F;&#x751F;&#x662F;&#x652F;&#x6301;&#x914D;&#x7F6E;&#x4E0D;&#x540C;&#x7684;buildType &#x4EE5;&#x53CA; flavor &#x7684;&#xFF0C; &#x5148;&#x770B;&#x4E00;&#x4E0B;&#x529F;&#x80FD;&#x5BF9;&#x6BD4;&#xFF1A;</p>
<h3 id="&#x5F53;&#x524D;&#x7684;&#x652F;&#x6301;&#x5EA6;">&#x5F53;&#x524D;&#x7684;&#x652F;&#x6301;&#x5EA6;</h3>
<table>
<thead>
<tr>
<th style="text-align:left">&#x63D2;&#x4EF6;</th>
<th style="text-align:center">falvor</th>
<th style="text-align:right">&#x81EA;&#x5B9A;&#x4E49;buildType</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">google&#x63D2;&#x4EF6;</td>
<td style="text-align:center">&#x652F;&#x6301;</td>
<td style="text-align:right">&#x652F;&#x6301;</td>
</tr>
<tr>
<td style="text-align:left">atlasplugin &#x6784;&#x5EFA;apk</td>
<td style="text-align:center">&#x652F;&#x6301;</td>
<td style="text-align:right">&#x4E0D;&#x652F;&#x6301;</td>
</tr>
<tr>
<td style="text-align:left">atlasplugin &#x6784;&#x5EFA;&#x52A8;&#x6001;&#x90E8;&#x7F72;</td>
<td style="text-align:center">&#x4E0D;&#x652F;&#x6301;</td>
<td style="text-align:right">&#x4E0D;&#x652F;&#x6301;</td>
</tr>
</tbody>
</table>
<h3 id="&#x4E3A;&#x4EC0;&#x4E48;&#x6CA1;&#x6709;&#x53BB;&#x5B8C;&#x5168;&#x9002;&#x914D;">&#x4E3A;&#x4EC0;&#x4E48;&#x6CA1;&#x6709;&#x53BB;&#x5B8C;&#x5168;&#x9002;&#x914D;</h3>
<ol>
<li>Atlas&#x662F;&#x9762;&#x5411;&#x591A;&#x4EBA;&#x534F;&#x4F5C;&#x7684;&#x8F83;&#x5927;&#x5DE5;&#x7A0B;&#x7684;&#xFF0C;&#x914D;&#x7F6E;&#x4E0D;&#x540C;&#x7684;buildtype&#x548C;flavor&#x4E2D;&#x4E5F;&#x4F1A;&#x5E26;&#x6765;&#x521B;&#x5EFA;&#x66F4;&#x591A;&#x7684;&#x4EFB;&#x52A1;&#xFF0C;&#x5E76;&#x4E14;&#x5982;&#x679C;&#x6267;&#x884C;assembleDebug &#x4E4B;&#x7C7B;&#x4F1A;&#x6784;&#x5EFA;&#x6240;&#x6709;&#x7684;&#x4F9D;&#x8D56;&#x53D8;&#x79CD;&#xFF0C;&#x5BFC;&#x81F4;&#x6574;&#x4F53;&#x6784;&#x5EFA;&#x6548;&#x7387;&#x5927;&#x5927;&#x964D;&#x4F4E;&#x3002;</li>
<li>&#x5F00;&#x53D1;&#x7CBE;&#x529B;&#x6240;&#x9650;&#xFF0C;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x7684;&#x6DD8;&#x5B9D;app&#x5C31;&#x662F;&#x6CA1;&#x6709;&#x53D8;&#x79CD;&#x7684;&#x67B6;&#x6784;&#xFF0C;&#x989D;&#x5916;&#x7684;&#x529F;&#x80FD;&#x4F1A;&#x5E26;&#x6765;&#x5F88;&#x591A;&#x9002;&#x914D;&#x7684;&#x9EBB;&#x70E6;&#x548C;&#x98CE;&#x9669;</li>
<li>&#x5F00;&#x53D1;&#x671F;&#x6211;&#x4EEC;&#x671F;&#x671B;&#x6211;&#x4EEC;&#x7684;&#x57FA;&#x7EBF;&#x8DB3;&#x591F;&#x7A33;&#x5B9A;&#xFF0C;&#x8FD9;&#x6837;&#x53EF;&#x4EE5;&#x907F;&#x514D;&#x52A8;&#x6001;&#x90E8;&#x7F72;&#x57FA;&#x7EBF;&#x4E0D;&#x517C;&#x5BB9;&#x7684;&#x95EE;&#x9898;</li>
</ol>
<h3 id="&#x5F53;&#x524D;&#x63D2;&#x4EF6;&#x4E0B;&#x7684;&#x5B9E;&#x8DF5;">&#x5F53;&#x524D;&#x63D2;&#x4EF6;&#x4E0B;&#x7684;&#x5B9E;&#x8DF5;</h3>
<p>&#x56E0;&#x4E3A;build.gradle &#x91CC;&#x53EF;&#x4EE5;&#x5199;&#x5F88;&#x591A;&#x7684;&#x903B;&#x8F91;&#xFF0C;&#x6240;&#x4EE5;&#x914D;&#x7F6E;&#x4E5F;&#x53EF;&#x4EE5;&#x53D8;&#x7684;&#x5F88;&#x7075;&#x6D3B;&#x3002; &#x6211;&#x4EEC;&#x4E00;&#x822C;&#x7684;&#x505A;&#x6CD5;&#x5C31;&#x662F;&#x901A;&#x8FC7;&#x6253;&#x5305;&#x53C2;&#x6570;&#x6765;&#x63A7;&#x5236;&#x4E0D;&#x540C;&#x7684;&#x53C2;&#x6570;&#x503C;&#xFF0C; &#x5177;&#x4F53;&#x7684;demo&#x53EF;&#x4EE5;&#x770B;&#x4E0B;&#x4E0B;&#x9762;&#x7684;&#x4ECB;&#x7ECD;&#xFF0C;&#x81F3;&#x4E8E;&#x5177;&#x4F53;&#x7684;&#x5176;&#x4ED6;&#x5B9E;&#x73B0;&#xFF0C;&#x5927;&#x5BB6;&#x4E5F;&#x53EF;&#x4EE5;&#x81EA;&#x884C;&#x6269;&#x5C55;</p>
<h4 id="&#x5927;&#x81F4;&#x6B65;&#x9AA4;">&#x5927;&#x81F4;&#x6B65;&#x9AA4;</h4>
<ol>
<li><p>&#x5728;build.gradle&#x91CC;&#x5B9A;&#x4E49;&#x4E00;&#x4E9B;&#x57FA;&#x7840;&#x7684;&#x53D8;&#x91CF;&#xFF0C;&#x6BD4;&#x5982;&#xFF1A;</p>
<pre><code> //&#x901A;&#x8FC7;&#x589E;&#x52A0;&#x5224;&#x65AD;&#x903B;&#x8F91;&#xFF0C;&#x6253;&#x51FA;&#x4E0D;&#x540C;&#x7C7B;&#x578B;&#x7684;&#x5B9A;&#x5236;&#x5305;
 def appId = &quot;com.taobao.demo&quot;
 def minVersion = 14
</code></pre></li>
</ol>
<ol>
<li>&#x589E;&#x52A0;&#x4E00;&#x5C42;&#x903B;&#x8F91;&#x63A7;&#x5236;&#x6839;&#x636E;&#x4E0D;&#x540C;&#x7684;&#x53C2;&#x6570;&#x6765;&#x4FEE;&#x6539;&#x4E4B;&#x524D;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;&#x7684;&#x503C; &#xFF0C; &#x8FD9;&#x6837;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x6253;&#x5305;&#x52A0;&#x4E86; -Pbeta, &#x5C31;&#x4F1A;&#x4F7F;&#x7528;&#x65B0;&#x7684;&#x503C;&#x4E86;</li>
</ol>
<pre><code>    if (project.hasProperty(&quot;beta&quot;)) {
        appId = &quot;com.taobao.atlas.beta&quot;
        minVersion = 21
    }
</code></pre><ol>
<li>&#x6216;&#x8005;&#x76F4;&#x63A5;&#x5728;&#x914D;&#x7F6E;&#x7684;&#x5730;&#x65B9;&#x52A0;&#x4E0A;&#x5224;&#x65AD;&#x903B;&#x8F91;&#xFF0C;&#x4F7F;&#x7528;&#x7279;&#x6B8A;&#x7684;&#x914D;&#x7F6E;</li>
</ol>
<pre><code>    android {
        defaultConfig {
            //&#x901A;&#x8FC7;&#x589E;&#x52A0;&#x5224;&#x65AD;&#x903B;&#x8F91;&#xFF0C;&#x6253;&#x51FA;&#x4E0D;&#x540C;&#x7C7B;&#x578B;&#x7684;&#x5B9A;&#x5236;&#x5305;
            if (project.hasProperty(&quot;beta&quot;)) {
                buildConfigField &quot;boolean&quot;, &quot;API_ENV&quot;, &quot;false&quot;
            }else{
                buildConfigField &quot;boolean&quot;, &quot;API_ENV&quot;, &quot;false&quot;
            }
        }
</code></pre><ol>
<li><p>&#x4EE5;&#x4E0A;build.gradle &#x91CC;&#x7684;&#x914D;&#x7F6E;&#x57FA;&#x672C;&#x5B8C;&#x6210;&#x3002; &#x540E;&#x7EED;&#x5982;&#x679C;&#x8981;&#x6253;&#x7279;&#x6B8A;&#x5305;&#x5C31;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4FEE;&#x6539;&#x914D;&#x7F6E;&#x7684;&#x6784;&#x5EFA;&#x53C2;&#x6570;&#x6765;&#x63A7;&#x5236;&#x6253;&#x5177;&#x4F53;&#x7684;&#x5305;&#x4E86;&#xFF0C;&#x5982;&#xFF1A;</p>
<pre><code>    ./gradlew clean assembleDebug :  &#x6784;&#x5EFA;&#x6807;&#x51C6;&#x5305;
    ./gradlew clean assembleDebug -Pbeta &#xFF1A; &#x6784;&#x5EFA;&#x7279;&#x6B8A;&#x5305;
</code></pre></li>
</ol>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="help.html" class="navigation navigation-prev " aria-label="Previous page: 故障排查">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="dynamic_failed_help.html" class="navigation navigation-next " aria-label="Next page: 动态部署失败排查指南">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"构建定制包","level":"1.5.3","depth":2,"next":{"title":"动态部署失败排查指南","level":"1.5.4","depth":2,"path":"faq/dynamic_failed_help.md","ref":"faq/dynamic_failed_help.md","articles":[]},"previous":{"title":"故障排查","level":"1.5.2","depth":2,"path":"faq/help.md","ref":"faq/help.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"faq/variant.md","mtime":"2017-11-27T09:41:28.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-11-27T10:00:49.012Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

